<!--
 * @Author: error: error: git config user.name & please set dead value or install git && error: git config user.email & please set dead value or install git & please set dead value or install git
 * @Date: 2023-11-27 09:36:09
 * @LastEditors: error: error: git config user.name & please set dead value or install git && error: git config user.email & please set dead value or install git & please set dead value or install git
 * @LastEditTime: 2023-11-30 10:16:12
 * @FilePath: /hgpt-admin/src/pages/addNews/index.vue
 * @Description: 文件介绍
 * 
 * Copyright (c) 2023 by ${git_name_email}, All Rights Reserved. 
-->
<template>
  <div class="addNewsContent">
    <div class="editItemBox">
      <div class="title">文章标题：</div>
      <div class="inputContent">
        <el-input placeholder="请输入"></el-input>
      </div>
    </div>
    <div class="editItemBox">
      <div class="title">列表图：</div>
      <div class="inputContent">
        <UploadFile />
      </div>
    </div>
    <div class="editItemBox">
      <div class="title">类型：</div>
      <div class="inputContent">
        <el-select v-model="newsType" placeholder="请选择" style="width: 300px">
          <el-option
            v-for="item in options"
            :key="item.value"
            :label="item.label"
            :value="item.value"
          >
          </el-option>
        </el-select>
      </div>
    </div>
    <div class="editItemBox">
      <div class="title">作者：</div>
      <div class="inputContent">
        <el-input placeholder="请输入"></el-input>
      </div>
    </div>
    <div class="editItemBox" v-if="newsType == 1">
      <div class="title">正文：</div>
      <div class="inputContent2">
        <quill-editor class="editor" v-model="contentText" ref="myQuillEditor">
        </quill-editor>
      </div>
    </div>
    <div class="editItemBox" v-else>
      <div class="title">视频：</div>
      <div class="inputContent">
        <UploadFile />
      </div>
    </div>
    <div class="bttomBtnBox">
      <el-button type="primary" @click="save">保存</el-button>
      <el-button>取消</el-button>
    </div>
  </div>
</template>

<script>
import UploadFile from "../../components/UploadFile.vue"
import { quillEditor } from 'vue-quill-editor'
export default {
  components: { UploadFile, quillEditor },
  data () {
    return {
      newsType: '1',
      options: [
        {
          value: '1',
          label: '图文'
        },
        {
          value: '2',
          label: '视频'
        }
      ],
      contentText: ""
    }
  },
  mounted () {
  },
  methods: {
    // 保存
    save () {
      console.log(this.contentText)
    },
  }
}
</script>
<style lang="scss" scoped>
.addNewsContent {
  .editItemBox {
    padding: 10px 0;
    padding-left: 150px;
    display: flex;
    .title {
      width: 100px;
    }
    .inputContent {
      width: 300px;
    }
    .inputContent2 {
      width: 600px;
    }
  }
  .bttomBtnBox {
    display: flex;
    justify-content: center;
  }
}
</style>>

